﻿<div id="grid" style="margin-left:1%;"></div>
<script type="text/javascript">
    var _window = {};

    _window.options = {
        /* grid */
        columns: [
            { name: 'flowname', display: '审批流程名称', width: 200 }
            , { name: 'username', display: '申请人姓名', width: 100 }
            , { name: 'dept', display: '申请部门', width: 100 }
            , { name: 'creationtime', display: '提交时间', width: 120 }
            , {
                display: '详情', width: 100,
                render: function (r) {
                    return '<a href="/Work/Info?taskobjectid=' + r.id + '" target="_self">查看</a>';
                }
            }
        ],
        toolbar: { items: [] }
    };

    _window.control = {
        grid: null
    };

    _window.grid = function () {
        _window.control.grid = $('#grid').ligerGrid({
            columns: _window.options.columns,
            //toolbar: { items: _window.options.toolbar },
            rownumbers: true,
            resizable: false,
            frozen: false,
            height: '98%',
            width: '98%',
            dataAction: 'local'
        });

        @{
            string data = "var data = { Total: " + ViewBag.Total +
                ", Rows: " + ViewBag.Rows.ToString() + "};";
        }
        @Html.Raw(data)

        _window.control.grid.loadData(data);
    }

    _window.init = function () {
        _window.grid();
    }

    /* ---------------------------------------------------------------------   */


    /* ---------------------------------------------------------------------   */
    $(document).ready(function () {
        _window.init();
    });
</script>